<?php
include_once '../util/db/Conn.php';
include_once '../util/ArrayList.php';
include_once '../util/db/model/Product.php';
include_once '../util/db/model/ProdType.php';
include_once '../util/db/model/SupplierBrand.php';
include_once '../util/db/service/ProdTypeDBUtil.php';
include_once '../util/db/service/SupplierBrandDBUtil.php';
include_once '../util/db/service/ProductDBUtil.php';
include_once '../util/db/model/ProductSearchPara.php';
$productSearchPara = new ProductSearchPara();
if(isset($_POST["p_name"]))
{
	$productSearchPara->setP_name($_POST["p_name"]);
}
if(isset($_POST["add_date"]))
{
	$productSearchPara->setAdd_date($_POST["add_date"]);
}
if(isset($_POST["sort"]))
{
	$productSearchPara->setSort($_POST["sort"]);
}
if(isset($_POST["sb_id"]))
{
	$productSearchPara->setSb_id($_POST["sb_id"]);
}
if(isset($_POST["sell_mode"]))
{
//	$sum=0;
//	foreach($_POST["sell_mode"] as $a)
//	{
//		$sum=$sum+(int)$a;
//	}
	$productSearchPara->setSell_mode($_POST["sell_mode"]);
//	echo $productArray->size();
}
	$productDBUtil =new ProductDBUtil();
	$productArray=$productDBUtil->queryAllByPara($productSearchPara);

?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/admin_page.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>庫存管理</title>
<!-- InstanceEndEditable -->
<style type="text/css">
<!--
#cantainer {
	width: 955px;
	margin-right: 33px;
	margin-left: 33px;
}
#header {
	width: 955px;
	margin-bottom: 10px;
	background-image: url(../../images/top_bg.png);
	height: 82px;
}
#body {
	width: 955px;
	margin-bottom: 10px;
}
#footer {
	width: 955px;
}
.style2 {color: #666666;
	font-size: 12px;
}
#contant_list {
	float: left;
	width: 180px;
	margin-right: 10px;
}
.style17 {color: #74B9E5; font-size: 14px; }
.style43 {font-size: 12px; color: #666666; font-weight: bold; }
#contant_body {
	float: right;
	width: 765px;
}
-->
</style>
<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
<!--
#contant_body_header {
	background-image: url(../images/admin_inventory_list_header.png);
	height: 62px;
	width: 765px;
	margin-bottom: 10px;
}
#contant_body_body {
	width: 765px;
	margin-bottom: 10px;
}
.style16 {font-size: 14px}
.style45 {color: #000000}
#contant_body_1_text {	height: 25px;
	width: 737px;
	margin-right: 10px;
	margin-bottom: 10px;
	margin-left: 10px;
	background-image: url(../images/admin_product_list.png);
}
#contant_body_1_1 {
	width: 737px;
	margin-right: 10px;
	margin-bottom: 10px;
	margin-left: 10px;
}
.style4 {font-size: 12px}
#contant_body_1_2 {
	width: 737px;
	margin-right: 10px;
	margin-bottom: 10px;
	margin-left: 10px;
}
-->
</style>
</head>
<script src="/shopping/shopcarda2/admin/js/jquery.js"></script>
<script src="/shopping/shopcarda2/admin/js/jquery.tablePagination.0.2.min.js"></script>
<script>
$(document).ready(function () {
	$("#table1").tablePagination(); 
});
</script>

<body>
<table width="1024" align="center" cellpadding="0" cellspacing="0">
	<tr>
		<td>
		<div id="cantainer">
		<div id="header"></div>
		<div id="body">
		<div id="contant_list">
		<table border="0" align="center" cellpadding="0" cellspacing="0">
			<tr>
				<td align="center"><img src="../../images/index_12.png" width="180" height="54" /></td>
			</tr>
			<tr>
				<td>
				<table width="180" border="0" align="center" cellpadding="0" cellspacing="0" background="../../images/index_12_20.png">
					<tr>
						<td width="10"></td>
						<td><?php
						include_once '../common/menu.php';
						?></td>
						<td width="10"></td>
					</tr>
				</table>
				</td>
			</tr>
			<tr>
				<td width="180" height="28" align="center">
				<table width="0" border="0" align="center" cellpadding="0"
					cellspacing="0">
					<tr>
						<td width="180" height="28" align="center"><img src="../../images/index_20.png" width="180" height="28" /></td>
					</tr>
				</table>
				</td>
			</tr>
		</table>
		</div>
		<!-- InstanceBeginEditable name="EditRegion1" -->
        <div id="contant_body">
          <div id="contant_body_header"></div>
          <div id="contant_body_body">
            <table  cellpadding="0" cellspacing="0">
              <tr>
                <td colspan="3"><img src="../../member/img/member_body_up.jpg" width="765" height="9" /></td>
              </tr>
              <tr>
                <td width="4" background="../../member/img/member_body_left.jpg">&nbsp;</td>
                <td width="757"><div id="contant_body_1_text"></div>
                  <div id="contant_body_1_1">
                    <table id="table1" width="100%" cellspacing="0" cellpadding="5">
                      <thead>
                        <th width="98" align="center" background="../../List_pages/images/products_contant_text_3.jpg" class="style4">商品貨號</th>
                        <th width="123" align="center" background="../../List_pages/images/products_contant_text_3.jpg" class="style4">商品名稱</th>
                        <th width="68" align="center" background="../../List_pages/images/products_contant_text_3.jpg" class="style4">上架日期</th>
                        <th width="79" align="center" background="../../List_pages/images/products_contant_text_3.jpg" class="style4">製造商</th>
                        <th width="77" align="center" background="../../List_pages/images/products_contant_text_3.jpg" class="style4">品牌</th>
                        <th width="300" align="center" background="../../List_pages/images/products_contant_text_3.jpg" class="style4">商品類別</th>
                        <th width="80" align="center" background="../../List_pages/images/products_contant_text_3.jpg" class="style4">販售方式</th>
                        <th width="67" align="center" background="../../List_pages/images/products_contant_text_3.jpg" class="style4">&nbsp;</th>
                      </thead>
                    <?php                              
					$supplierBrandDBUtil=new SupplierBrandDBUtil();
					$supplierBrandArray= $supplierBrandDBUtil->queryAll();
					for($i = 0; $i < $productArray->size (); $i ++) {
						$product=$productArray->get($i);
					?>
                     <tr>
                        <td align="center" class="style4"><?php echo $product->getProd_no();?></td>
                        <td align="center" class="style4"><?php echo $product->getP_name();?></td>
                        <td align="center" class="style4"><?php echo $product->getAdd_date();?></td>
                        <td align="center" class="style4"><?php echo $product->getSupplierBrand()->getLogo_name();?></td>
                        <td align="center" class="style4"><?php echo $product->getSupplierBrand()->getLogo_name_en();?></td>
                        <td align="center" class="style4"><?php echo $product->getProdType()->getType();?>/<?php echo $product->getProdSubType()->getSub_type();?></td>
                        <td align="center" class="style4"><?php 
                          	switch ($product->getSell_mode()){
                          		case 1:
                          			echo "正品";
                          			break;
                          		case 2:
                          			echo "特價";
                          			break;
                          		case 3:
                          			echo "預售";
                          			break;
                          		case 4:
                          			echo "下架";
                          			break;
                         	}
                          ?></td>
                        <td align="center" class="style4"><a href="admin_inventory_change.php?p_id=<?php echo $product->getP_id();?>">庫存調整</a></td>
                      </tr>
 					<?php 								
								}                           
                             ?>   
                      
                     </table>
                  </div>
</td>
                <td width="4" background="../../member/img/member_body_right.jpg">&nbsp;</td>
              </tr>
              <tr>
                <td height="9" colspan="3"><img src="../../member/img/member_body_down.jpg" width="765" height="9" /></td>
              </tr>
            </table>
          </div>
        </div>
        <!-- InstanceEndEditable --></div>
      <div id="footer">
        <table width="955" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td width="230" height="118" align="center"><a href="index.html"><img width="200" height="66" alt="logo位置" style="background-color: #FF0000" /></a></td>
            <td width="10" align="center"><img src="../../images/end_Separateline1.png" width="1" height="80" /></td>
            <td width="715" valign="middle"><table width="715" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td height="40" valign="top" class="style2"><table border="0" cellpadding="0" cellspacing="0">
                      <tr>
                        <td width="50" align="center" class="style2"></td>
                        <td>本平台中台灣各店家所銷售的商品或服務，都是由各該店家所銷售或提供。 | 電話 : 02-2275-3588 | 傳真 : 02-2275-3788<br/>
                          微衡科技　版權所有 ⓒ 2011 Microbalance. All Rights Reserved.</td>
                      </tr>
                  </table></td>
                </tr>
            </table></td>
          </tr>
        </table>
      </div>
      </div></td>
  </tr>
</table>
</body>
<!-- InstanceEnd --></html>
